package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsClusterModelConfig;
import com.econ.powercloud.ems.dal.mapper.EmsClusterModelConfigMapper;
import com.mysql.cj.util.StringUtils;
import org.springframework.stereotype.Repository;

/**
 * @Author : zjf
 * @Description :
 * @Date : 2022/5/26 16:53
 * @Modified by : zjf
 */
@Repository
public class EmsClusterModelConfigDAO extends ServiceImpl<EmsClusterModelConfigMapper, EmsClusterModelConfig> {

    public Page<EmsClusterModelConfig> selectByModelName(String modelName, Integer pageNo, Integer pageSize){
        LambdaQueryWrapper<EmsClusterModelConfig> wrapper = Wrappers.lambdaQuery();
        wrapper.like(!StringUtils.isNullOrEmpty(modelName), EmsClusterModelConfig::getModelName, modelName);
        Page<EmsClusterModelConfig> page = new Page<>(pageNo, pageSize);
        return this.baseMapper.selectPage(page,wrapper);
    }
}
